package com.cl.myInterface.impl;

import com.cl.container.ClBean;
import com.cl.container.MyContainer;
import com.cl.myInterface.DisposeClass;
import com.cl.util.ScannerClass;

import java.util.List;

/*
* 初始化bean
* */
public class InitAllClBean implements DisposeClass {
    @Override
    public int order() {
        return 3;
    }

    @Override
    public void dispose(List<Class> clazz) {
        /*
         * 初始化bean
         * */
        MyContainer.getInjectClassMap().forEach((beanName, beanClass) -> {
            //创建bean收集进容器
            ClBean clBean = ScannerClass.preCreateBean(beanName,beanClass);
            if (clBean != null) {
                //装入容器
                MyContainer.putBean(beanName, clBean);
            }
        });

    }
}
